#include <iostream>
#include <vector>

using namespace std;

static const int N = 4;
static const int target = 10;

int value[N] = {1, 2, 5, 10};
int flag[N] = {0};
int total = 0;
vector<int> ans;

void dfs(int depth)
{
	if (total > target)
	{
		return;
	}

	if (total == target)
	{
		for (const int &i : ans)
		{
			cout << i << " ";
		}
		cout << endl;
	}

	for (int i = depth; i < N; ++i)
	{
		total += value[i];
		ans.push_back(value[i]);
		dfs(i);
		ans.pop_back();
		total -= value[i];
	}
}

int main(int argc, char *argv[])
{
	dfs(0);
	return 0;
}
